require "Dialogs"

Arena.Resize(565, 130)
Player.sprite.alpha = 0

function Update()
	DialogUpdate()
	if Encounter.GetVar("vel") > 210 and not dialogs then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Bubble("[noskip][font:papyrus][voice:papyrus]B-[w:10]bueno,[w:10] eso\nno es lo que\nesperaba...", "top", 300.5, 355, 10, 94.5, 1)
		else
			Bubble("[noskip][font:papyrus][voice:papyrus]W-[w:10]well,[w:10] that's\nnot what i\nexpected...", "top", 300.5, 355, 10, 94.5, 1)
		end
		dialogs = 1
		Encounter.SetVar("tempStop", true)
	elseif Encounter.GetVar("vel") > 510 then
		if not Black then
			Black = CreateSprite("Pixel","Top")
			Black.color = {0,0,0}
			Black.Scale(640, 480)
			Black.MoveTo(320, 240)
			Black.alpha = 0
		else
			Black.alpha = Black.alpha + 0.02
			if Black.alpha >= 1 then
				Black.Remove()
				Encounter.SetVar("Animation", "None")
				Encounter.SetVar("vel", 0)
				Encounter.SetVar("nextwaves", {"Overworld/Genocide"})
				State("DEFENDING")
			end
		end
	end
	if dialogs and Bubbles[1] and not Bubbles[1].Activo then
		if dialogs == 1 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Bubble("[noskip][font:papyrus][voice:papyrus]Pero...", "top", 300.5, 355, 10, 94.5, 1)
			else
				Bubble("[noskip][font:papyrus][voice:papyrus]But...", "top", 300.5, 355, 10, 94.5, 1)
			end
			dialogs = 2
		elseif dialogs == 2 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Bubble("[noskip][font:papyrus][voice:papyrus]To...[w:10] todavía![w:10]\nCreo en ti!", "top", 300.5, 355, 10, 94.5, 1)
			else
				Bubble("[noskip][font:papyrus][voice:papyrus]St...[w:10] still![w:10]\nI believe in\nyou!", "top", 300.5, 355, 10, 94.5, 1)
			end
			dialogs = 3
		elseif dialogs == 3 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Bubble("[noskip][font:papyrus][voice:papyrus]Puedes ser una\nmejor persona!", "top", 300.5, 355, 10, 94.5, 1)
			else
				Bubble("[noskip][font:papyrus][voice:papyrus]You can be a\nbetter person!", "top", 300.5, 355, 10, 94.5, 1)
			end
			dialogs = 4
		elseif dialogs == 4 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Bubble("[noskip][font:papyrus][voice:papyrus]Incluso si no\nlo crees!", "top", 300.5, 355, 10, 94.5, 1)
			else
				Bubble("[noskip][font:papyrus][voice:papyrus]Even if you\ndon't think so!", "top", 300.5, 355, 10, 94.5, 1)
			end
			dialogs = 5
		elseif dialogs == 5 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Bubble("[noskip][font:papyrus][voice:papyrus][waittall:5][effect:shake]Lo...[w:20][waittall:10]\nLO PROMETO...", "top", 300.5, 355, 10, 94.5, 1)
			else
				Bubble("[noskip][font:papyrus][voice:papyrus][waittall:5][effect:shake]I...[w:20][waittall:10]\nI PROMISE...", "top", 300.5, 355, 10, 94.5, 1)
			end
			dialogs = 6
		elseif dialogs == 6 then
			Encounter.SetVar("tempStop", nil)
			dialogs = 7
		end
	end
end